home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #6
/
Amiga Plus CD - 2004 - No. 06.iso
/
AmigaPlus
/
Begleitmaterial
/
50Tools
/
Grafik
/
PerfectPaint
/
rexx
/
box
/
3DGrid.rx
next >
Wrap
Text File
|
2001-05-05
|
7KB
|
450 lines
/* Box arexx */
options results
parse ARG Port x1 y1 x2 y2 b
ADDRESS value Port
pp_CountFrames
Total_Frame=result
if Total_Frame=0 then Total_Frame=1
Start_Frame=1
End_Frame=Total_Frame
IF x1>x2 then DO
X=x1;x1=x2;x2=X
END
IF y1>y2 then DO
Y=y1;y1=y2;y2=Y
END
Bw=(x2-x1)+1
Bh=(y2-y1)+1
Cx=x1+Bw/2
Cy=y1+Bh/2
R=-1
Path=0;Type=0
Anim=0
Start_Shearx=5
Start_Sheary=5
Start_rotx=0
Start_roty=0
Start_rotz=0
Start_size=100
Start_O=100
End_Shearx=5
End_Sheary=5
End_rotx=0
End_roty=0
End_rotz=0
End_size=100
End_O=100
DO UNTIL R>-1
pp_DialogInit 250 245 "*3DGrid*" 11
pp_Cycle 10 70 5 100 16 "Animation" 1 "No|Yes" Anim
pp_Cycle 0 70 30 100 16 "Path" 1 "None|Left|Right|Up|Down" Path
pp_Cycle 1 70 48 100 16 "Type" 1 "In|Out" Type
pp_Button 2 20 66 200 16 '*Frame*(*#'||Start_Frame||'->#'||End_Frame||'*)*'
pp_Integer 3 56 91 60 16 'Line' 0 Start_Shearx
pp_Integer 4 156 91 60 16 'Row' 0 Start_Sheary
pp_Button 5 20 116 200 16 '*Rot*X*(*'||Start_rotx||'*->*'||End_rotx||'*)*'
pp_Button 6 20 134 200 16 '*Rot*Y*(*'||Start_roty||'*->*'||End_roty||'*)*'
pp_Button 7 20 152 200 16 '*Rot*Z*(*'||Start_rotz||'*->*'||End_rotz||'*)*'
pp_Button 8 20 175 200 16 '*Size*%*(*'||Start_size||'*->*'||End_size||'*)*'
pp_Button 9 20 193 200 16 '*Opacity*(*'||Start_O||'*->*'||End_O||'*)*'
pp_Dialog
R=result
pp_GetDialog 10
Anim=Result
pp_GetDialog 0
Path=result
pp_GetDialog 1
Type=result
pp_GetDialog 3
Start_Shearx=result
pp_GetDialog 4
Start_Sheary=result
if R=-9 then DO
if Anim=1 then DO
pp_DialogInit 150 80 "*OPACITY*" 2
pp_Integer 0 60 5 50 16 "Start" 1 Start_O
pp_Integer 1 60 25 50 16 "End" 1 End_O
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_O=result
pp_GetDialog 1
End_O=result
END
END
ELSE DO
pp_DialogInit 150 55 "*OPACITY*" 1
pp_Integer 0 75 5 50 16 "Opacity" 1 Start_O
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_O=result
End_O=result
END
END
END
if R=-8 then DO
IF Anim=1 then DO
pp_DialogInit 150 80 "*SIZE*%*" 2
pp_Integer 0 60 5 50 16 "Start" 1 Start_size
pp_Integer 1 60 25 50 16 "End" 1 End_size
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_size=result
pp_GetDialog 1
End_size=result
END
END
ELSE DO
pp_DialogInit 150 55 "*SIZE*" 1
pp_Integer 0 60 5 50 16 "Size*%" 1 Start_S
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_S=result
End_S=result
END
END
END
if R=-5 then DO
if Anim=1 then DO
pp_DialogInit 150 80 "*ROT*X*" 2
pp_Integer 0 60 5 50 16 "Start" 1 Start_rotx
pp_Integer 1 60 25 50 16 "End" 1 End_rotx
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_rotx=result
pp_GetDialog 1
End_rotx=result
END
END
ELSE DO
pp_DialogInit 150 55 "*ROT*X*" 1
pp_Integer 0 60 5 50 16 "RotX" 1 Start_rotx
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_rotx=result
End_rotx=result
END
END
END
if R=-6 then DO
IF Anim=1 then DO
pp_DialogInit 150 80 "*ROT*Y*" 2
pp_Integer 0 60 5 50 16 "Start" 1 Start_roty
pp_Integer 1 60 25 50 16 "End" 1 End_roty
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_roty=result
pp_GetDialog 1
End_roty=result
END
END
ELSE DO
pp_DialogInit 150 55 "*ROT*Y*" 1
pp_Integer 0 60 5 50 16 "RotY" 1 Start_roty
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_roty=result
End_roty=result
END
END
END
if R=-7 then DO
IF Anim=1 then DO
pp_DialogInit 150 80 "*ROT*Z*" 2
pp_Integer 0 60 5 50 16 "Start" 1 Start_rotz
pp_Integer 1 60 25 50 16 "End" 1 End_rotz
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_rotz=result
pp_GetDialog 1
End_rotz=result
END
END
ELSE DO
pp_DialogInit 150 55 "*ROT*Z*" 1
pp_Integer 0 60 5 50 16 "RotZ" 1 Start_rotz
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_rotz=result
End_rotz=result
END
END
END
if R=-2 then DO
pp_DialogInit 150 80 "*FRAME*" 2
pp_Integer 0 60 5 50 16 "Start" 1 Start_Frame
pp_Integer 1 60 25 50 16 "End" 1 End_Frame
pp_Dialog
rc=result
IF rc=1 then DO
pp_GetDialog 0
Start_Frame=result
pp_GetDialog 1
End_Frame=result
IF End_Frame>Total_Frame THEN DO
End_Frame=Total_Frame
END
IF Start_Frame>End_Frame THEN DO
Start_Frame=1
END
END
END
END
if R=0 then DO
pp_PermitRefresh
EXIT
END
IF Anim=0 then DO
pp_UpdateUndo
pp_3DPrep 200 200 Start_rotx Start_roty-90 Start_rotz
IF Start_O<100 then DO
pp_EffectOn
pp_Trans Start_O
CALL Grid(Start_Shearx,Start_Sheary,Bw,Bh,Cx,Cy)
pp_EffectOff
END
ELSE DO
CALL Grid(Start_Shearx,Start_Sheary,Bw,Bh,Cx,Cy)
END
END
ELSE DO
pp_CountFrames
IF result<2 then do
pp_Warn 'Make*an*Anim*first.'
EXIT
END
pp_GetWidth
W=result
pp_GetHeight
H=result
HX=Bw/2
HY=Bh/2
Start_X=Cx
End_X=Cx
Start_Y=Cy
End_Y=Cy
IF Path=1 then DO
IF Type=0 then DO
Start_X=HX*-1
END
ELSE DO
End_X=HX*-1
END
END
IF Path=2 then DO
IF Type=0 then DO
Start_X=W+HX
END
ELSE DO
End_X=W+HX
END
END
IF Path=3 then DO
IF Type=0 then DO
Start_Y=HY*-1
END
ELSE DO
End_Y=HY*-1
END
END
IF Path=4 then DO
IF Type=0 then DO
Start_Y=H+HY
END
ELSE DO
End_Y=H+HY
END
END
step=(End_Frame-Start_Frame)
Step_rotx=(End_rotx-Start_rotx)/Step
Step_roty=(End_roty-Start_roty)/Step
Step_rotz=(End_rotz-Start_rotz)/Step
Step_Size=(End_Size-Start_Size)/Step
Step_O=(End_O-Start_O)/Step
Step_X=(End_X-Start_X)/Step
Step_Y=(End_Y-Start_Y)/Step
DO i=Start_Frame to End_Frame
pp_GotoFrame i
rotx=trunc(Start_rotx+Step_rotx*(i-Start_Frame)+0.5,0)
roty=trunc(Start_roty+Step_roty*(i-Start_Frame)+0.5,0)
rotz=trunc(Start_rotz+Step_rotz*(i-Start_Frame)+0.5,0)
Size=trunc(Start_Size+Step_Size*(i-Start_Frame)+0.5,0)
O=trunc(Start_O+Step_O*(i-Start_Frame)+0.5,0)
X=trunc(Start_X+Step_X*(i-Start_Frame)+0.5,0)
Y=trunc(Start_Y+Step_Y*(i-Start_Frame)+0.5,0)
Sizex=trunc((Bw*Size)/100,0)
Sizey=trunc((Bh*Size)/100,0)
pp_3DPrep 200 200 rotx roty-90 rotz
IF O<100 then DO
pp_EffectOn
pp_Trans O
CALL Grid(Start_Shearx,Start_Sheary,Sizex,Sizey,X,Y)
pp_EffectOff
END
ELSE DO
CALL Grid(Start_Shearx,Start_Sheary,Sizex,Sizey,X,Y)
END
END
END
EXIT
Grid: PROCEDURE
XX=ARG(1)
YY=ARG(2)
W=ARG(3)
H=ARG(4)
Cx=ARG(5)
Cy=ARG(6)
t1=W/XX
t2=H/YY
i=0
DO j=0 to XX
Dx=i-W/2
Dy=0
Dz=-1*H/2
pp_3Dto2D Dx Dy Dz Cx Cy
pp_3DGetx
x.1=result
pp_3DGety
y.1=result
Dx=i-W/2
Dy=0
Dz=t2*YY-H/2
pp_3Dto2D Dx Dy Dz Cx Cy
pp_3DGetx
x.2=result
pp_3DGety
y.2=result
pp_Line x.1 y.1 x.2 y.2
i=i+t1
END
i=0
DO j=0 to YY
Dx=-1*W/2
Dy=0
Dz=i-H/2
pp_3Dto2D Dx Dy Dz Cx Cy
pp_3DGetx
x.1=result
pp_3DGety
y.1=result
Dx=t1*XX-W/2
Dy=0
Dz=i-H/2
pp_3Dto2D Dx Dy Dz Cx Cy
pp_3DGetx
x.2=result
pp_3DGety
y.2=result
pp_Line x.1 y.1 x.2 y.2
i=i+t2
END
RETURN